package com.gmlive.common.sample.update.entity

import com.google.gson.annotations.SerializedName

data class UpdateData(
        @SerializedName("url")
        val apkUrl: String,
        @SerializedName("version")
        val version: String,
        @SerializedName("isPredown")
        val isSilent: Int = 0,
        @SerializedName("isForce")
        val isForce: Int = 0,
        @SerializedName("forceCount")
        val promptCount: Int = 0, // 提醒次数
        @SerializedName("md5")
        val md5: String, // 文件md5
        @SerializedName("cancelDesc")
        val cancelText: String,
        @SerializedName("confirmDesc")
        val okText: String,
        @SerializedName("title")
        val title: String,
        @SerializedName("desc")
        val content: String,
        @SerializedName("packageSize")
        val apkTotalSize: Int,
        @SerializedName("wording")
        val noVersionPrompt: String,
        @SerializedName("isLastest")
        val isLatest: Boolean = true,
        @SerializedName("upID")
        val updateId: Int
)

fun UpdateData.hasNewVersion(): Boolean {
    return !isLatest && apkUrl.isNotBlank() && version.isNotBlank() && md5.isNotBlank() && content.isNotBlank()
}